﻿CREATE PROCEDURE [dbo].[SetWorklogCategories]
	@categoryIds VARCHAR(MAX),
	@worklogID int
AS
BEGIN
	delete from		WorkCategory 
	where			WorkLogId = @worklogID
	
	insert into WorkCategory
	(
		WorkLogId,
		CategoryId
	)
	select		@worklogID as WorkLogId, 
				CAST(ITEM as INT) as CategoryId 
	from dbo.StringSplit( @categoryIds, ',' )


END